package fr.snac.notification;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import fr.snac.utils.Constants;

public class ServiceRestarterReceiver extends BroadcastReceiver{

	@Override
	public void onReceive(Context context, Intent intent) {

		SharedPreferences settings = context.getSharedPreferences(Constants.SETTINGS_PREFERENCES, 0);
		boolean serviceActivated = settings.getBoolean(Constants.SETTINGS_SERVICE_ACTIVATED, false);

		if (serviceActivated)
			context.startService(new Intent(context, CheckService.class));

		settings = null;
	}

}
